widget: Add private get_border_allocation
authorTimm Bäder <mail@baedert.org>
Fri, 5 May 2017 10:54:24 +0000 (12:54 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 20 Jul 2017 01:27:11 +0000 (21:27 -0400)
gtk/gtkwidget.c
gtk/gtkwidgetprivate.h

index 5d7f9ab8e2a18d792cb95a38130adcdee42424df..cb1048e2220ea9f47188f2779ed38943e216c843 100644 (file)
@@ -13669,6 +13669,28 @@ gtk_widget_get_content_allocation (GtkWidget     *widget,
                         margin.bottom + border.bottom + padding.bottom;
 }
 
+void
+gtk_widget_get_border_allocation (GtkWidget     *widget,
+                                  GtkAllocation *allocation)
+{
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
+  GtkBorder margin, border;
+  GtkCssStyle *style;
+
+  style = gtk_css_node_get_style (priv->cssnode);
+  get_box_margin (style, &margin);
+  get_box_border (style, &border);
+
+  *allocation = priv->allocation;
+
+  allocation->x += margin.left + border.left;
+  allocation->y += margin.top + border.top;
+  allocation->width -= margin.left + border.left +
+                       margin.right + border.right;
+  allocation->height -= margin.top + border.top +
+                        margin.bottom + border.bottom;
+}
+
 /**
  * gtk_widget_set_allocation:
  * @widget: a #GtkWidget
index 404969bc916ce2d35e6a8c8cdbcb937c6dd895e3..e9acd9acf31dde5888ec6481b6b503b72c2a9eb6 100644 (file)
@@ -320,6 +320,8 @@ gboolean          gtk_widget_focus_move                    (GtkWidget        *wi
                                                             GPtrArray        *focus_order);
 void              gtk_widget_get_content_allocation        (GtkWidget        *widget,
                                                             GtkAllocation    *allocation);
+void              gtk_widget_get_border_allocation         (GtkWidget        *widget,
+                                                            GtkAllocation    *allocation);
 
 GtkWidget *       gtk_widget_common_ancestor               (GtkWidget *widget_a,
                                                             GtkWidget *widget_b);